import java.util.Scanner;

/**
 * @author zhaoqian
 * @create 2021/9/3 20:57
 */
public class main11 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()){
            String s = in.nextLine();
            int p=0;
            String s1 = s.replace(",", "");
            String[] split = s1.split("0");
            for (String a:split) {
                if (a.length()==0){
                    continue;
                }
                if (a.length()>3){
                    if (a.length()/3>0){
                        p=p+a.length()/3;
                    }
                    if (a.length()%3>0){
                        p++;
                    }
                }else if (a.length()<=3){
                    p++;
                }

            }
            System.out.println(p);
        }


    }
}
